{% extends "base.html" %}
{% load i18n %}

{% autoescape off %}
{% block html_head_ext %}
<link rel="stylesheet" type="text/css" 
      href="{{ base_site_url }}/dms_media/javascript/yui/build/fonts/fonts-min.css" />
<link rel="stylesheet" type="text/css" 
      href="{{ base_site_url }}/dms_media/javascript/yui/build/datatable/assets/skins/sam/datatable.css" />
<script type="text/javascript" 
      src="{{ base_site_url }}/dms_media/javascript/yui/build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" 
      src="{{ base_site_url }}/dms_media/javascript/yui/build/element/element-beta.js"></script>
<script type="text/javascript" 
      src="{{ base_site_url }}/dms_media/javascript/yui/build/datasource/datasource-beta.js"></script>
<script type="text/javascript" 
      src="{{ base_site_url }}/dms_media/javascript/yui/build/datatable/datatable-beta.js"></script>
{% endblock %}

{% block frame_left %}{% endblock %}

{% block title %} {{title}}: <i>{{sub_title}}</i> {% endblock %}

{% block content %}

<p>
{% blocktrans %}
Mit folgendem Formular geben Sie Beiträge für RSS-Feeds frei bzw.
schalten diese auf unsichtbar
{% endblocktrans %}
</p>

<form method = "post"
      action = "{{ next }}">
<div class="yui-skin-sam">
  <div id="markup">
  <table id="items" class="form-table" style="width:100%;">

<tbody>
{% if objs %}
  {% for obj in objs %}
  <tr>
  <td class="bottom-border-ex" width="5%">
  <input type="checkbox" name="visible_{{ obj.id }}"
         {% if obj.is_browseable %}checked="checked"{% endif %} />
  </td>
  <td class="bottom-border-ex" width="50%">
  <a href="{{ obj.url }}" title="Objekt anzeigen">{{ obj.title }}</a>
  </td>
  <td class="bottom-border-ex" width="25%">
  {{ obj.feed_title }}
  </td>
  <td class="bottom-border-ex" width="20%">
  {{ obj.last_modified }}
  </td>
  <td class="bottom-border-ex" width="5%">
  <input type="checkbox" name="delete_{{ obj.id }}"
         {% if obj.is_deleted %}checked="checked"{% endif %} />
</td>
  </tr>
  {% endfor %}
{% else %}
<tr>
<td colspan="8">
{% trans "Bislang gibt es keine Beiträge für RSS-Feeds." %}
</td>
</tr>
{% endif %}

</tbody>

</table>
</div>
</div>

<p align="right" style="margin-top:0.5em;">
<input name="submit" type="submit" value="{% trans "Freigeben/Löschen ..." %}" />
</p>
</form>

<script type="text/javascript">
my_formatDate = function(el, oRecord, oColumn, oData) {
  var oDate = oData;
  if(oDate instanceof Date) {
    el.innerHTML = oDate.getDate() + "." + (oDate.getMonth()+1) + "." + oDate.getFullYear() + " " + oDate.getHours() + ":" + oDate.getMinutes();
  }
  else {
    el.innerHTML = YAHOO.lang.isValue(oData) ? oData : "";
  }
};

YAHOO.util.Event.addListener(window, "load", function() {
    YAHOO.example.EnhanceFromMarkup = new function() {
        var myColumnDefs = [
            {key:"sort",label:"Sichtbar",sortable:true},
            {key:"title",label:"Überschrift",sortable:true},
            {key:"rssfeed",label:"RSS-Feed",sortable:true},
            {key:"date",label:"Datum",formatter:my_formatDate,sortable:true},
            {key:"delete",label:"Löschen",sortable:true}
        ];

        this.myDataSource = new YAHOO.util.DataSource(YAHOO.util.Dom.get("items"));
        this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
        this.myDataSource.responseSchema = {
            fields: [ {key:"sort"}, {key:"title"}, {key:"rssfeed"},
                      {key:"date", parser:YAHOO.util.DataSource.parseDate}, {key:"delete"} ]
        };

        this.myDataTable = new YAHOO.widget.DataTable("markup", myColumnDefs, this.myDataSource,
                {sortedBy:{key:"sort",dir:"desc"}});
        };
});
</script>
{% endblock %}
{% endautoescape %}
